home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / TCL1 / __MANDEL / MANDELBR / CMANDELA.C next >
Text File  |  1992-05-31  |  1KB  |  85 lines

  1. /*****
  2.  * CMandelApp.c
  3.  *****/
  4.  
  5. #include "CMandelApp.h"
  6. #include "CMandelDoc.h"
  7. #include <Commands.h>
  8.  
  9. extern    OSType    gSignature;
  10.  
  11. #define        kExtraMasters        4
  12. #define        kRainyDayFund        20480
  13. #define        kCriticalBalance    20480
  14. #define        kToolboxBalance        20480
  15.  
  16. void CMandelApp::IMandelApp(void)
  17.  
  18. {
  19.     CApplication::IApplication( kExtraMasters, kRainyDayFund, 
  20.                         kCriticalBalance, kToolboxBalance);
  21.     
  22.     CApplication::cMaxSleepTime = 10;
  23. }
  24.  
  25. void CMandelApp::SetUpFileParameters(void)
  26.  
  27. {
  28.     inherited::SetUpFileParameters();    /* Be sure to call the default method */
  29.     sfNumTypes = 2;
  30.     sfFileTypes[0] = 'TEXT';
  31.     sfFileTypes[1] = 'DATA';
  32.     gSignature = '????';
  33. }
  34.  
  35. void CMandelApp::DoCommand(
  36.     register long    theCommand)            /* Command number                    */
  37. {
  38.     if (theCommand == cmdAbout) {
  39.         
  40.         ZapMouseRgn();
  41.         SetCursor(&arrow);
  42.         NoteAlert(2048, NULL);
  43.     }
  44.     else
  45.         inherited::DoCommand(theCommand);
  46. }
  47. void CMandelApp::CreateDocument()
  48.  
  49. {
  50.     CMandelDoc    *theDocument = NULL;
  51.     
  52.     TRY
  53.     {
  54.         theDocument = new(CMandelDoc);
  55.         theDocument->IMandelDoc(this, TRUE);
  56.         theDocument->NewFile();
  57.     }
  58.     
  59.     CATCH
  60.     {
  61.          if (theDocument) theDocument->Dispose();
  62.     }
  63.     ENDTRY;
  64. }
  65.  
  66. void CMandelApp::OpenDocument(SFReply *macSFReply)
  67.  
  68. {
  69.     CMandelDoc    *theDocument = NULL;
  70.     
  71.     TRY
  72.     {
  73.     
  74.         theDocument = new(CMandelDoc);
  75.         theDocument->IMandelDoc(this, TRUE);
  76.         theDocument->OpenFile(macSFReply);
  77.     }
  78.     
  79.     CATCH
  80.     {
  81.          if (theDocument) theDocument->Dispose();
  82.     }
  83.     ENDTRY;
  84. }
  85.